<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="/law-list.html" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" method="post" action="/selectLaws">
          <label>法规别名：</label><input type="text" name="alias" th:value="${alias}"  placeholder="请输入法规部号" autocomplete="off" class="layui-input">
          <label>法规名称：</label><input type="text" name="title" th:value="${title}" placeholder="请输入法规名称" autocomplete="off" class="layui-input">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
        <button class="layui-btn" onclick="x_admin_show('添加法规','./law-add.html')"><i class="layui-icon"></i>添加</button>
      </xblock>

      <table class="layui-table">
        <thead>
        <tr>
          <th>法规部号</th>
          <th>法规别名</th>
          <th>法规版本号</th>
          <th>法规名称</th>
          <th>该法规是否显示</th>
          <th style="width: 700px">法规版本说明</th>
          <th>操作</th>
        </thead>
        <tbody>
        <tr th:each="laws:${lawsList}">
          <td th:text="${laws.lawsBranch}">25</td>
          <td th:text="${laws.lawsAlias}">CCAR-25-R4</td>
          <td th:text="${laws.lawsVersion}">R4</td>
          <td th:text="${laws.lawsName}">运输类飞机适航标准</td>
          <td> <span class="layui-btn layui-btn-normal layui-btn-mini" th:if="${laws.state==1}" th:text="显示">已显示</span>
            <span class="layui-btn layui-btn-normal layui-btn-mini" th:if="${laws.state==2}" th:text="已失效">已显示</span>
            <span class="layui-btn layui-btn-normal layui-btn-mini" th:if="${laws.state==0}" th:text="已废止">已显示</span>
          </td>
          <td th:text="${laws.lawsImprint}">中国成本价差不多时间不吃技术部腹背受敌吧v商家的吧v和vdhfvfdhvufdbvbd个日光我偶尔会高IE换个然后给</td>
          <td class="td-manage">
            <input type="hidden" th:value="${laws.id}">
            <a title="修改"  class="toUpdateLaw"  href="javascript:;">
              <i class="layui-icon">&#xe642;</i>
            </a>
            <a title="删除" class="deleteLaw" href="javascript:;">
              <i class="layui-icon ">&#xe640;</i>
            </a>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

      $(".toUpdateLaw").click(function (){
        var id = $(this).prev().val();
       x_admin_show('编辑','toUpdateLaw?id='+id);
      });

      /*用户-删除*/
      $(".deleteLaw").click(function (){
        var id =$(this).parent().children().first().val();
        var body=$(this).parent().parent();
        if ( confirm('确认要删除吗？')){
          $.ajax({
            url:"deleteLaw",
            type:"post",
            dataType:"json",
            data:{"id":id},
            success:function (result){
              if(result==1) {
                body.remove();
                layer.msg('已删除!', {icon: 1, time: 1000});
              }else{
                layer.msg('删除失败!', {icon: 1, time: 1000});
              }
            }
          })
        }
      });
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>